package com.ytjj.qmyx.admin.controller.data;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.data.response.PageStatisticsResponse;
import com.ytjj.qmyx.admin.service.data.PageStatisticsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 运营页面统计控制器
 *
 * 
 *  *
 **/
@RestController
@RequestMapping("/operate")
public class OperateStatisticsController {

    @Resource
    private PageStatisticsService pageStatisticsService;


    /**
     * 页面统计
     */
    @GetMapping("/getPageStatistics")
    public CommonResult getPageStatistics(@RequestParam(required = false) String platform,
                                          @RequestParam Integer timeType,
                                          @RequestParam(required = false) String channel) {
        PageStatisticsResponse pageStatisticsResponse = pageStatisticsService.getPageStatistics(platform, timeType, channel);
        return CommonResult.success(pageStatisticsResponse);
    }

    /**
     * 获取路径配置
     *
     * @return
     */
    @GetMapping("/getPathConfig")
    public CommonResult getPathConfig() {
        return CommonResult.success(pageStatisticsService.getPathConfig());
    }


    /**
     * 页面统计
     */
    @GetMapping("/getPageStatisticsList")
    public CommonResult getPageStatisticsList(@RequestParam(required = false) String platform,
                                              @RequestParam(required = false) String code,
                                              @RequestParam(required = false) String channel,
                                              @RequestParam String startTime,
                                              @RequestParam String endTime) {
        return CommonResult.success(pageStatisticsService.getPageStatisticsList(platform, code, channel,startTime,endTime));
    }

}
